#define _CRT_SECURE_NO_WARNINGS 1
#include<iostream>
using namespace std;
using ll = long long;
ll a, b, m, n, l;
ll exgcd(ll a, ll b, ll& x, ll& y)
{
    if (!b)
    {
        x = 1, y = 0;
        return a;
    }
    ll d = exgcd(b, a % b, y, x);
    y -= a / b * x;
    return d;
}
int main()
{
    cin >> a >> b >> m >> n >> l;
    ll x, y;
    ll d = exgcd(m - n, l, x, y);
    if ((b - a) % d != 0) cout << "Impossible" << endl;
    else
    {
        ll t = abs(l / d);
        x *= (b - a) / d;
        cout << (x % t + t) % t << endl;
    }
    return 0;
}